const express = require("express");
const cors = require("cors");

const bodyParser = require("body-parser");

const app = express();
const userRouter = require("./router");

// 启用 CORS
app.use(cors());
app.use(bodyParser.json());
express.urlencoded({ extended: true });

// 设置静态文件目录
app.use(express.static("public"));

// 使用路由
app.use("/api", userRouter);

const PORT = 3000;
app.listen(PORT, () => {
    console.log("服务器运行在 http://localhost:3000");
});
